package com.bw.hxc.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowCredentials(true)//携带参数认证
                .maxAge(3600)
                .allowedOrigins("*")
                .allowedMethods("GET","POST","PUT","DELETE","HEAD")
                .allowedHeaders("*");//允许各种头的信息
    }
}
